// views/home/index.js
Page({
  clickBox() {
    console.log("box", Date.now())
  },
  clickBox1() {
    console.log("box1 111111111", Date.now())
  },
  bannerChange(event) {
    // console.log(event.detail)
  },
  getphonenumber(event) {
    console.log(event)
  },
  getuserinfo(event) {
    console.log(event)
  },
  chooseavatar(event) {
    console.log(event)
  },
  data: {
    images: [
      "/images/banner/liuyifei.webp",
      "/images/banner/wbb.jpeg",
      "/images/banner/lyf.webp",
      "/images/banner/wbb1.jpeg",
    ],
    array: ['美国', '中国', '巴西', '日本'],
    index: 0,
    time: "00:00",
    date: "2022-03-07",
    region: ['广东省', '广州市', '海珠区'],
    customItem: '全部',
  },
  bindPickerChange(event) {
    this.setData({
      index: event.detail.value
    })
    console.log(event.detail.value)
  },
  bindTimeChange(event) {
    console.log(event)
  },
  bindDateChange(event) {
    console.log(event)
  },
  bindRegionChange(event) {
    console.log(event)
  },
  toAbout() {
    wx.navigateTo({
      url: "../about/index"
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

    console.log(options.query)
    const eventChannel = this.getOpenerEventChannel()
    eventChannel.emit('acceptDataFromOpenedPage', { data: 'test'})
    eventChannel.emit('someEvent', {data: 'test'})
    // 监听acceptDataFromOpenerPage事件，获取上一页面通过eventChannel传送到当前页面的数据
    eventChannel.once('acceptDataFromOpenerPage', data => {
      console.log(data)
    })


    // wx.getUserInfo({
    //   success(res) {
    //     console.log(res)
    //   }
    // })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})
